#pragma once

#include "FSMObject.h"
#include "TransitionData.h"
#include "Action.h"

class CAction;
class CStateBase;

/*!
 * \brief Transition between states
 *
 * Transition between states
 */
class CTransition : public CFSMObject
{
	DECLARE_RTTI_CLASS( CTransition, CFSMObject::GetRTTI( ) );

	//================================== METHODS ==============================

public:
	//! Constructor method
	CTransition(const SmartPtr<CStateBase> &pState, const SmartPtr<CStateBase> &pNextState);
	//! Check if transition is trigged
	virtual bool_t IsTrigger();
	//! Get state
	SmartPtr<CStateBase> &GetState();
	//! Get next state
	SmartPtr<CStateBase> &GetNextState();
	//! Add action
	void AddAction(const CActionPtr &pAction);
	//! Get size actions
	u32_t GetSizeActions();
	//! GetAction
	CActionPtr GetAction(u32_t idx);

	//================================ DATA MEMBERS ===========================

private:
	//! Origin state
	SmartPtr<CStateBase> m_pState;
	//! Destination state
	SmartPtr<CStateBase> m_pNextState;
	//! Action list executed 
	TActionList m_vActions;
};

//============================== TYPE DEFINITIONS =========================

//! Transition smart pointer
typedef SmartPtr<CTransition> CTransitionPtr;

//! Transition smart pointer list
typedef CVector<CTransitionPtr> TTransitionList;
